/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.basic.hazard.sds.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.basic.common.constant.enums.ParkBasicModDictEnum;
import com.hopes.bizz.basic.common.constant.enums.ParkBasicSysDictEnum;
import com.hopes.bizz.common.core.util.StringUtils;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.admin.api.resolver.enums.SysDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 企业危险化学品SDS
 *
 * @author daijie
 * @date 2023-11-13 11:10:15
 */
@Data
@TableName("haz_chemical_sds")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "企业危险化学品SDS")
public class HazChemicalSdsEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 标识
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "标识")
    private Long id;

    /**
     * 危化品MSDS标识
     */
    @Schema(description = "危化品MSDS标识")
    private Long msdsId;

    /**
     * 编码
     */
    @Schema(description = "编码")
    private String sdsCode;

    /**
     * 危险化学品名称
     */
    @Schema(description = "危险化学品名称")
    private String name;

    /**
     * CAS号
     */
    @Schema(description = "CAS号")
    private String casNo;

    /**
     * 中文别名
     */
    @Schema(description = "中文别名")
    private String aliasZh;

    /**
     * 英文名
     */
    @Schema(description = "英文名")
    private String enName;

    /**
     * 英文别名
     */
    @Schema(description = "英文别名")
    private String aliasEn;

    /**
     * 化学品类型
     */
    @Schema(description = "化学品类型")
    private String chemicalType;

    /**
     * 分子式
     */
    @Schema(description = "分子式")
    private String molecularFormula;

    /**
     * 分子量
     */
    @Schema(description = "分子量")
    private String molecularWeight;

    /**
     * 结构式
     */
    @Schema(description = "结构式")
    private String structuralImg;

    /**
     * 设计生产能力
     */
    @Schema(description = "设计生产能力")
    private BigDecimal designStock;

    /**
     * 设计最大储存量
     */
    @Schema(description = "设计最大储存量")
    private BigDecimal designMaxStock;

    /**
     * 主要用途
     */
    @Schema(description = "主要用途")
    private String mainUsage;

    /**
     * 是否有中间存储设施
     */
    @Schema(description = "是否有中间存储设施")
    private Boolean middleStorageFlag;

    /**
     * 中间最大存储量
     */
    @Schema(description = "中间最大存储量")
    private BigDecimal middleMaxStock;

    /**
     * SDS文档
     */
    @Schema(description = "SDS文档")
    private String sdsFile;

    /**
     * 标签文档
     */
    @Schema(description = "标签文档")
    private String lableFile;

    /**
     * 鉴定报告
     */
    @Schema(description = "鉴定报告")
    private String reportFile;

    /**
     * 危险性类别
     */
    @Schema(description = "危险性类别")
    private String hazardClass;

    /**
     * 象形图编码
     */
    @Schema(description = "象形图编码")
    private String warningImgCode;

    /**
     * 警示词
     */
    @Schema(description = "警示词")
    private String warningWord;

    /**
     * 危险性说明
     */
    @Schema(description = "危险性说明")
    private String hazardDesc;

    /**
     * 是否重点监管化学品
     */
    @Schema(description = "是否重点监管化学品")
    private Boolean keyFlag;

    /**
     * 是否特别管控危险化学品
     */
    @Schema(description = "是否特别管控危险化学品")
    private Boolean specialFlag;

    /**
     * 是否易制毒化学品
     */
    @Schema(description = "是否易制毒化学品")
    private Boolean toxicFlag;

    /**
     * 是否剧毒化学品
     */
    @Schema(description = "是否剧毒化学品")
    private Boolean highlyToxicFlag;

    /**
     * 是否易制爆化学品
     */
    @Schema(description = "是否易制爆化学品")
    private Boolean explodeFlag;

    /**
     * 物理状态
     */
    @Schema(description = "物理状态")
    private String physicalState;

    /**
     * 外观形状
     */
    @Schema(description = "外观形状")
    private String appearance;

    /**
     * 溶解性
     */
    @Schema(description = "溶解性")
    private String dissolution;

    /**
     * 气味
     */
    @Schema(description = "气味")
    private String smell;

    /**
     * 熔点凝固点
     */
    @Schema(description = "熔点凝固点")
    private String freezingPoint;

    /**
     * 费点或初费点
     */
    @Schema(description = "费点或初费点")
    private String boilingPoint;

    /**
     * 沸程
     */
    @Schema(description = "沸程")
    private String boilingRange;

    /**
     * 蒸汽压
     */
    @Schema(description = "蒸汽压")
    private String vapourPressure;

    /**
     * pH值
     */
    @Schema(description = "pH值")
    private String phValue;

    /**
     * 密度
     */
    @Schema(description = "密度")
    private String density;

    /**
     * 运动粘度
     */
    @Schema(description = "运动粘度")
    private String kinematicViscosity;

    /**
     * 水中溶解度
     */
    @Schema(description = "水中溶解度")
    private String waterSolubility;

    /**
     * 闪点
     */
    @Schema(description = "闪点")
    private String flashPoint;

    /**
     * 相对蒸汽密度
     */
    @Schema(description = "相对蒸汽密度")
    private String vapourDensity;

    /**
     * 相对水密度
     */
    @Schema(description = "相对水密度")
    private String waterDensity;

    /**
     * 气味阈值
     */
    @Schema(description = "气味阈值")
    private String smellValue;

    /**
     * 蒸发速率
     */
    @Schema(description = "蒸发速率")
    private String evaporationRate;

    /**
     * 爆炸下限
     */
    @Schema(description = "爆炸下限")
    private String explodeLower;

    /**
     * 爆炸上限
     */
    @Schema(description = "爆炸上限")
    private String explodeUpper;

    /**
     * 自燃温度
     */
    @Schema(description = "自燃温度")
    private String autoignitionTemp;

    /**
     * 分解温度
     */
    @Schema(description = "分解温度")
    private String decompositionTemp;

    /**
     * 稳定性
     */
    @Schema(description = "稳定性")
    private String stability;

    /**
     * 聚合危害
     */
    @Schema(description = "聚合危害")
    private String polymerizationHazard;

    /**
     * 燃烧性
     */
    @Schema(description = "燃烧性")
    private String combustibility;

    /**
     * 其他物理性质
     */
    @Schema(description = "其他物理性质")
    private String otherProperty;

    /**
     * UN号
     */
    @Schema(description = "UN号")
    private String unNo;

    /**
     * 危险货物分类
     */
    @Schema(description = "危险货物分类")
    private String hazardGoodsClass;

    /**
     * 存储安全性要求
     */
    @Schema(description = "存储安全性要求")
    private String sotrageDesc;

    /**
     * 使用安全性要求
     */
    @Schema(description = "使用安全性要求")
    private String useDesc;

    /**
     * 运输安全性要求
     */
    @Schema(description = "运输安全性要求")
    private String transportDesc;

    /**
     * 急救措施
     */
    @Schema(description = "急救措施")
    private String fistAidDesc;

    /**
     * 泄漏应急处置措施
     */
    @Schema(description = "泄漏应急处置措施")
    private String emergencyDesc;

    /**
     * 消防措施
     */
    @Schema(description = "消防措施")
    private String fireContralDesc;

    /**
     * 状态
     */
    @Schema(description = "状态")
    private String status;

    /**
     * 机构ID
     */
    @Schema(description = "机构ID")
    private Long orgId;

    public String getOrgIdStr() {
        return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company, this.orgId);
    }

    public String getChemicalTypeStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_chemical_type, this.chemicalType);
    }

    public String getStatusStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_process_status, this.status);
    }

    public String getKeyFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.keyFlag);
    }

    public String getSpecialFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.specialFlag);
    }

    public String getHighlyToxicFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.highlyToxicFlag);
    }

    public String getMiddleStorageFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.middleStorageFlag);
    }

    public String getExplodeFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.explodeFlag);
    }

    public String getToxicFlagStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.toxicFlag);
    }

    public String getPhysicalStateStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_physical_state, this.physicalState);
    }

    public String getStabilityStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_stability, this.stability);
    }

    public String getPolymerizationHazardStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.haz_polymerization_hazard, this.polymerizationHazard);
    }

    public String getCombustibilityStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_combustibility, this.combustibility);
    }

    public String getWarningWordStr() {
        return DictResolver.getItemLabelByValue(ParkBasicSysDictEnum.hazard_warning_word, this.warningWord);
    }

    public String getWarningImgCodeStr() {
        return DictResolver.getItemLabelByValue(ParkBasicModDictEnum.pictogram_code, this.warningImgCode);
    }

    public String getSdsFileStr() {
        if (StringUtils.isNotBlank(this.sdsFile)) {
            return this.sdsFile.substring(this.sdsFile.lastIndexOf("/") + 1);
        }
        return StringUtils.EMPTY;
    }

    public String getLableFileStr() {
        if (StringUtils.isNotBlank(this.lableFile)) {
            return this.lableFile.substring(this.lableFile.lastIndexOf("/") + 1);
        }
        return StringUtils.EMPTY;
    }

    public String getReportFileStr() {
        if (StringUtils.isNotBlank(this.reportFile)) {
            return this.reportFile.substring(this.reportFile.lastIndexOf("/") + 1);
        }
        return StringUtils.EMPTY;
    }
}
